home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / DSHJ2 / BUTOR.S < prev    next >
Encoding:
Text File  |  2001-02-10  |  2.7 KB  |  122 lines

  1.  
  2.         .globl    _BUT_OR,_BADDR,_BSTATE,_BREAL
  3.                 .globl  _clrmem
  4.         .globl  _gdostst
  5.         .globl  _OVMOUSE,_NVMOUSE,_KICKAES
  6.         .globl  _gcurx,_gcury
  7.  
  8.  
  9. *    The right and left buttons are ORed together as the Left button
  10. *    flag and passed to the AES mouse button interrupt routine. 
  11. *
  12. *  in:
  13. *    _BUT_ADDR contains the address of the AES interrupt routine
  14. *    that deals with mouse buttons.
  15. *
  16. * out:
  17. *    _BUT_STATE contains the actual mouse button state prior to ORing
  18.  
  19.  
  20.  
  21. _BUT_OR:    and.w    #$FFFF,d0
  22.         tst     d0
  23.         move.w  d0,_BREAL
  24.         beq    place
  25.           move.w    d0,_BSTATE
  26.         move.w    #1,d0
  27. place:        move.l    _BADDR,-(sp)
  28.         rts                ; jmp to AES subroutine
  29.  
  30.  
  31.  
  32. *************************************************************************
  33. *                                    *
  34. *    CLRMEM                                *
  35. *                                    *
  36. *    This routine clears an arbitrary block of memory.        *
  37. *    The block length must be an even integer less then 16 Megabytes.*
  38. *    The block must start on a word boundary                *
  39. *                                    *
  40. *    Inputs:    d0.L = Number of bytes to Clear                *
  41. *        a0   = Ptr to Memory to Clear                *
  42. *                                    *
  43. *    Outputs:    None                        *
  44. *                                    *
  45. *    Registers Modified:    d0-d2, a0-a2                *
  46. *                                    *
  47. *************************************************************************
  48. _clrmem:
  49.         move.l  4(sp),a0
  50.     move.l  8(sp),d0
  51.  
  52.     movem.l    d3-d7,-(sp)
  53.     moveq.l    #0,d1
  54.     moveq.l    #0,d2
  55.     moveq.l    #0,d3
  56.     moveq.l    #0,d4
  57.     moveq.l    #0,d5
  58.     moveq.l    #0,d6
  59.     moveq.l    #0,d7
  60.     move.l    d1,a2        * 32 bytes of Zero
  61.     move.l    d0,temp2    * save total size in bytes (assumed to be even)
  62.     move.l    a0,a1
  63.     adda.l    d0,a1        * a1 = EOMemory Block
  64.     and.l    #$ffffff00,d0
  65.  
  66.     beq    clearlast    * WHILE (Pages Remain) DO
  67.     asr.l    #8,d0
  68.     subq.w    #1,d0        * NOTE: 16-Megabyte Maximum
  69. clear1:
  70.     movem.l    d1-d7/a2,-(a1)
  71.     movem.l    d1-d7/a2,-(a1)
  72.     movem.l    d1-d7/a2,-(a1)
  73.     movem.l    d1-d7/a2,-(a1)
  74.     movem.l    d1-d7/a2,-(a1)
  75.     movem.l    d1-d7/a2,-(a1)
  76.     movem.l    d1-d7/a2,-(a1)
  77.     movem.l    d1-d7/a2,-(a1)    * Clear a Page (256 bytes)
  78.     dbra    d0,clear1
  79. clearlast:
  80.     move.l    temp2,d0    * d0 = total size in bytes (assumed to be even)
  81.     and.w    #$0ff,d0
  82.     asr.w    #1,d0
  83.     beq    cleardone    * IF (Last Page Remains) THEN
  84.     subq.w    #1,d0        * FOR (All Words Remaining) DO
  85. clear2:    move.w    d1,-(a1)    * Clear Word
  86.     dbra    d0,clear2
  87. cleardone:
  88.     movem.l    (sp)+,d3-d7
  89.     rts
  90.  
  91.  
  92.  
  93. _gdostst: move.w #-2,d0
  94.       trap   #2
  95.       rts
  96.  
  97.  
  98. _NVMOUSE: rts
  99.  
  100. _KICKAES: move.w  SR,-(sp)
  101.       ori.w   #$0700,SR
  102.           movea.l _gcurx,a0
  103.       move.w  (a0),d0
  104.           movea.l _gcury,a0
  105.           move.w  (a0),d1
  106.        move.l  _OVMOUSE,a0
  107.       jsr (a0)
  108.           move.w  (sp)+,SR
  109.       rts
  110.  
  111.                 .bss
  112.  
  113.         .even
  114. temp2:          .ds.l   1
  115. _BADDR:        .ds.l    1
  116. _BSTATE:    .ds.w    1
  117. _BREAL:        .ds.w    1
  118. _OVMOUSE:    .ds.l   1
  119. _temp3:        .ds.l    1
  120.  
  121.         .end
  122.